function danmu()
{
    var icon = arrforone(['','s','e','w','a','h','css/img.png']);
    var type = arrforone(['w','b']);

    var tip = '随机弹幕'+randbix(1,10);
    xtip.danmu(tip,{
        /*icon: icon,*/
        type: type,
    });
}

//数组随机取值
function arrforone(items)
{
    var item = items[Math.floor(Math.random()*items.length)];
    return item;
}

var dm;
function danmulist2()
{
    danmu();
    dm = setInterval(function(){
        danmu();
    },3*300);
    return dm;
}

function danmuclose()
{
    if(dm){
        clearInterval(dm);
        dm = null;
    }
}

function randomNum(n,m)
{
    var rander = Math.round(Math.random()*(m-n))+n;
    return rander;
}

//随机小数点
function randbix(n,m)
{
    var bix = Math.random().toFixed(2);
    var num = Number(randomNum(n,m)) + Number(bix);
    var r2 = randomNum(2,10);
    return num.toFixed(r2);
}

danmu.danmulist2 = danmulist2;
danmu.danmus = danmu
danmu.arrforone = arrforone

export default danmu;